package com.jiejie.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jiejie.entity.Comments;
import com.jiejie.entity.Customer;
import com.jiejie.entity.Likes;
import com.baomidou.mybatisplus.extension.service.IService;

import java.awt.print.Pageable;
import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author 辰广
 * @since 2022-10-05
 */
public interface ILikesService  {
    public Likes getById(Integer likesId);
    public int saveLikes(Likes likes);
    public int updateLikes(Likes likes);
    public int deleteById(Integer likesId);
    //批量保存
    int  saveAll(List<Likes> likesList);
    //根据评论id,查出这条评论的赞（总赞数）
    List<Likes> getLikedListByLikedCommentId(Integer LikedCommentId);
    //根据用户查出所有他点过的赞
    List<Likes> getLikesByCustomer(Integer customerId);
    //通过评论ID和用户ID查询是否存在点赞记录
    Likes getLikesBycomIdAndcustId(Integer comId,Integer CustId);
    //将redis里的点赞数据存入数据库中
    void transLikedFromRedisDB();
    //将Redis中的点赞数量数据存入数据库
    void transLikedCountFromRedisDB();
    //点赞用户，被点赞评论,点赞状态0
    void saveLikedRedis(Integer likedCustomerId,Integer likedCommentId);
    //取消点赞 状态1
    void unlikeFromRedis(Integer likedCustomerId,Integer likedCommentId);
    /**
     * 从Redis中删除一条点赞数据
     */
    void deleteLikedFromRedis(Integer likedCustomerId,Integer likedCommentId);
    //评论点赞数+1
    void incrementLikeedCount(String likedCommentId);
    //评论点赞数减一
    void decrementLikedCount(String likedCommentId);
    /**
     *Redis中存储的所有点赞数据
     */
    List<Likes> getLikedDataFromRedis();
    /**
     * 获取Redis中存储的所有点赞数量
     */
    List<Comments> getLikesNumFromRedis();
    public List<Comments> getLikesNumFromRedisFrojsp();
    public List<Likes> getLikedDataFromRedisForJsp();


}
